﻿using System.Collections.Generic;
using System.Numerics;

namespace PEProtocol
{
    public enum SWorldType
    {
        None,
        Resident, //主城常驻公共地图
        TemporarySingle, //临时副本，单人地图
        TemporaryTeam, //临时副本 组队地图
        CrossRealm,  //跨战场地图
    }

    public enum DeviceFunctionEnum
    {
        None = 0,
        TransMap,//离开当前地图，传送新地图
        TransPos, //传送当前地图新位置
        OpenUI, //打开UI窗口
    }

    public class StageConfig
    {
        public int StageID;  //关卡ID
        public bool IsGhost; //是否为镜像场景，只切换怪物，不切换场景
        public string StageName; //关卡名称
        public string SceneName; //场景名称
        public CPlayMode PlayMode; //关卡模式

        public int[] NPCArr;  //NPC集合
        public SWorldType WorldType; //Server端地图运行模式
        public int[] MCCIDArr; //循环刷的怪物
        public int[] DeviceIDArr; //地图中的装置，如传送阵
    }

    public class NPCConfig
    {
        public int NPCID;
        public int StageID;
        public Vector3 Pos;
        public Vector3 Rot;
        public string Name;
        public string Path;
    }

    public class DeviceConfig
    {
        public int DeviceID;
        public Vector3 Pos;
        public Vector3 Rot;
        public string Name;
        public string Path;

        public int OpenCondition; //开启条件 0：一直开发 1：本地定时开放 2：服务器通知开放 3：任务条件开放
        public DeviceFunctionEnum EffectEnum; //作用类型
        public object[] Args;
    }
    public enum CPlayMode
    {
        None,
        Login, //登录模式 
        Create, //角色创建模式
        Major, //主城模式，主要是客户端NPC任务，社交平台，技能效果表现等
        Wild, //野外模式 （野外刷怪，采集材料等任务）
        Single, //单人副本模式， 单人战斗
        Multiple, //多人组队模式，多人战斗
        Activity, //定时运营活动，世界战Boss
        Guild,  //工会战，
        Marriage, //结婚场景
        Fishing, //钓鱼模式
        Concert, //演奏模式
    }
    public class XlsConfigTool
    {
        public static List<StageConfig> mStageConfigs = new List<StageConfig>()
        {
            new StageConfig(){ StageID = 1,StageName = "账号登录",SceneName = "001_Login",PlayMode = CPlayMode.Login},
            new StageConfig(){StageID = 2,StageName = "角色创建",SceneName = "002_Create",PlayMode =  CPlayMode.Create},
            new StageConfig()
            {
                StageID = 3,StageName = "主城",SceneName = "101_MajorCity",PlayMode = CPlayMode.Major,
                IsGhost = false,NPCArr = new int[]{101001,101002},
                WorldType = SWorldType.Resident,
                MCCIDArr = new int[]{10101},
                DeviceIDArr = new int[]{101201,101202},
            },
        };

        public static List<NPCConfig> mNPCConfigs = new List<NPCConfig>()
        {
            new NPCConfig()
            {
                NPCID = 101001,StageID = 101,Pos = new Vector3(-6,0,-6),Rot = new Vector3(0,145,0),Name = "老夫子",
                Path = "NPC_FuZi"
            },
            new NPCConfig()
            {
                NPCID = 101002,StageID = 101,Pos = new Vector3(6,0,6),Rot = new Vector3(0,180,0),Name = "大师兄",
                Path = "NPC_Senior"
            },

        };

        public static List<DeviceConfig> mDeviceConfig = new List<DeviceConfig>()
        {
            new DeviceConfig()
            {
              DeviceID  = 101201,Pos = new Vector3(-8.64f,0,-9.67f), Rot = new Vector3(0,30,-9.67f),Name = "野外传送阵",
              Path = "Prop_Portal",OpenCondition = 0,EffectEnum = DeviceFunctionEnum.TransMap,Args = new object[]{103}
            },
            new DeviceConfig()
            {
                DeviceID  = 101202,Pos = new Vector3(0f,0,-9.67f), Rot = new Vector3(0,30,-9.67f),Name = "世界站Boss入口",
                Path = "Prop_BossFight",OpenCondition = 2,EffectEnum = DeviceFunctionEnum.TransMap,Args = new object[]{401}
            },

        };
   
        public static StageConfig GetStageConfig(int stageID)
        {
            return mStageConfigs.Find(x => x.StageID == stageID);
        }

        public static NPCConfig GetNPCConfig(int npcID)
        {
            return mNPCConfigs.Find(x => x.NPCID == npcID);
        }

        public static DeviceConfig GetDeviceConfig(int deviceID)
        {
            return mDeviceConfig.Find(x => x.DeviceID == deviceID);
        }


    }

}